#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, k, T, a[505], p[505];
bool check(int w) {
  int tot = 0, t = 0;
  for (int i = 1; i <= n; i = ++i) {
    tot += a[i];
    if (tot > w) tot = a[i], t++;
  }
  return t < k;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> T;
  while (T--) {
    memset(p, 0, sizeof(p));
    int l = 0, r = 0, val = 0;
    cin >> n >> k;
    for (int i = 1; i <= n; i = ++i) cin >> a[i], l = max(l, a[i]), r += a[i];
    while (l < r) {
      int mid = l + r >> 1;
      if (check(mid))
        r = mid;  //二分
      else
        l = mid + 1;
    }
    k--;
    for (int i = n; i >= 1;
         i--) {  // 因为要求前面的分组之和尽可能小，所以倒序遍历
      val += a[i];
      if (val > l)
        val = a[i], p[i] = 1,
        k--;  //当前缀和大于答案时前缀和清零，再加上当前的数
    }
    for (int i = 1; i <= n && k; i = ++i)
      if (!p[i])  //如果当前已经要输出斜杠，就不统计了
        p[i] = 1, k--;
    for (int i = 1; i < n; i = ++i) {
      cout << a[i] << ' ';
      if (p[i]) cout << '/' << ' ';
    }
    cout << a[n] << '\n';
  }
  return 0;
}
